package com.x.springboot.service;

import com.x.springboot.dto.UserDTO;
import com.x.springboot.model.User;
import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageInfo;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.List;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author x.li
 * @since 2021-06-04
 */
public interface UserService extends IService<User> {

    void create(User user);

    void delete(Integer id);

    void deleteBatch(List<Integer> ids);

    void update(User user);

    User get(Long id);

    PageInfo<User> query(User user, int pageNum, int pageSize);

    /**
     * 注册功能
     */
    User register( UserDTO userDTO);

    /**
     * 登录功能
     * @param username 用户名
     * @param password 密码
     * @return 生成的JWT的token
     */
    String login(String username,String password);

    /**
     * 刷新token的功能
     * @param oldToken 旧的token
     */
    String refreshToken(String oldToken);

    User getAdminByUsername(String username);

    UserDetails loadUserByUsername(String username);
}
